Many applications today utilize composited images or sounds. This is done, for example, to display a picture which includes two or more original images, or to transmit a sound which is an incorporation of two or more original sounds. Such compositing of image or sound requires a scaling of the original components.
Scaling often utilizes division by a number which is not a multiple of two. Generally, division by a multiple of two is simple in a binary system. Shifting the number to the right by the number to which two is raised to obtain the divisor provides the correct result. For example, to divide by 8, shift right by 3, since 2.sup.3 =8.
However, division by numbers which are not multiples of two is more complex. One prior art method of dividing a remainder by divisor is a multistep process. The remainder has twice as many bits as the divisor. For example, if the remainder is a 64 bit number, the divisor is a 32 bit number.
First, the remainder register is shifted left by one bit. Next, the divisor register is subtracted from the left half of the remainder register, and the result is placed in the left half of the remainder register. Next, it is tested whether the remainder is less than zero or not. If the remainder is greater than or equal to zero, the remainder register is shifted to the left by one, setting the new rightmost bit to 1. If the remainder is less than zero, the divisor is added to the left half of the remainder register, and the remainder register is shifted to the left, setting the new rightmost bit to 0.
This process is repeated as many times as the size of the divisor. In one example, for a 32 bit divisor, the process is repeated 32 times. After the last repetition, the left half of the remainder is shifted right by 1 bit. This process produces an accurate result. However, as can be seen, for a divisor which is over three bits this process is time consuming.
Additionally, when a sixteen bit number is divided by an eight bit number, the result is a sixteen bit number. If the divisor is a large number, this results in an eight bit number with leading zeroes expanding it to a sixteen bit number. This requires extra space for storing the number, and more complicated processing.